package cn.pink.core.support.observer;

import cn.pink.core.support.Param;

/**
 * 具体主题
 * 事件主题 发布事件
 * @Author: pink
 * @Date: 2022/6/30 11:16
 */
public class EventSubject extends Subject {
    /** 实例化单例 */
    public static final EventSubject instance = new EventSubject();

    /**
     * 发布
     */
    public static void fire(int key) {
        instance.notice(key, null, null);
    }

    public static void fire(int key, Object subKey) {
        instance.notice(key, subKey, null);
    }

    public static void fire(int key, Param param) {
        instance.notice(key, null, param);
    }

    public static void fire(int key, Object subKey, Param param) {
        instance.notice(key, subKey, param);
    }

    public static void fire(int key, Object...params) {
        instance.notice(key, null, new Param(params));
    }

    public static void fire(int key, Object subKey, Object...params) {
        instance.notice(key, subKey, new Param(params));
    }
}
